#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    string s;
    cin >> s;
    string t = "codeforces";
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

signed main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}